Don't leak a list when activating keybindings
authorMatthias Clasen <mclasen@redhat.com>
Fri, 15 Apr 2011 00:22:18 +0000 (20:22 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 15 Apr 2011 00:22:18 +0000 (20:22 -0400)
Patch by Rui Matos,
https://bugzilla.gnome.org/show_bug.cgi?id=647790

gtk/gtkkeyhash.c
gtk/gtkmenushell.c

index df67f53af85a186d4a861be03478e3c684f541d6..f5063f7322d35c615a2d616ad9b51b7e3fbfe4d7 100644 (file)
@@ -372,8 +372,9 @@ keyval_in_group (GdkKeymap  *keymap,
  * This means that fuzzy matches won't be considered if their keyval is 
  * present in the current group.
  * 
- * Return value: A #GSList of matching entries.
- **/
+ * Return value: A newly-allocated #GSList of matching entries.
+ *     Free with g_slist_free() when no longer needed.
+ */
 GSList *
 _gtk_key_hash_lookup (GtkKeyHash      *key_hash,
                      guint16          hardware_keycode,
index 0f22d4782df75b5db56d1a9d6366ba67211381e0..1a5a097cf6499e45137ebff8bec630059ad15226 100644 (file)
@@ -1860,8 +1860,11 @@ gtk_menu_shell_activate_mnemonic (GtkMenuShell *menu_shell,
                                   event->group);
 
   if (entries)
-    result = _gtk_mnemonic_hash_activate (mnemonic_hash,
-                                          GPOINTER_TO_UINT (entries->data));
+    {
+      result = _gtk_mnemonic_hash_activate (mnemonic_hash,
+                                            GPOINTER_TO_UINT (entries->data));
+      g_slist_free (entries);
+    }
 
   return result;
 }